package com.sztz.batch;

import com.sztz.entity.User;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.lang.Nullable;

import java.sql.ResultSet;
import java.sql.SQLException;


/**
 * 用户信息Mysql结果集映射
 * @author yzy
 * @date 2022/8/30 15:18
 */
public class UserRowMapper implements RowMapper<User> {
    @Nullable
    @Override
    public User mapRow(ResultSet resultSet, int i) throws SQLException {
        User user = new User();
        user.setUserCode(resultSet.getString("USER_CODE"));
        user.setSex(resultSet.getInt("SEX"));
        user.setUserName(resultSet.getString("USER_NAME"));
        user.setPhone(resultSet.getString("PHONE"));
        return user;
    }
}
